<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<button id="btn">添加列表项目</button>
<ul id="list">
    <li>列表项目1</li>
    <li>列表项目2</li> 
    <li>列表项目3</li>
</ul>

<script>


var ul=document.getElementById("list");
var lis=ul.getElementsByTagName("li");
for(var i=0;i<lis.length;i++){
	lis[i].addEventListener('click',function(e){
		var e = e || window.event;
		var target = e.target || e.srcElement;
		alert(e.target.innerHTML);
	},false);
}
var i = 4;
var btn=document.getElementById("btn");
btn.addEventListener("click",function(){
	var li = document.createElement("li");
	li.innerHTML = "列表项目" + i++;
	ul.appendChild(li);
});


</script>
</body>
</html>
